﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _03_锯齿数组
{
    class Program
    {
        static void Main(string[] args)
        {
            int[][] arr_int = new int[2][];
            arr_int[0] = new int[] { 1, 2, 3, 4, 5, 6, 7 };
            arr_int[1] = new int[] { 1, 2, 3, 4, 5 };
            Console.WriteLine("---------foreach 循环------------");
            foreach (int[] i in arr_int)
            {
                foreach (int j in i)
                {
                    Console.WriteLine(j);
                }
            }
            Console.WriteLine("---------for循环------------");

            for (int i = 0; i < arr_int.Length; i++)
            {
                for (int j = 0; j < arr_int[i].Length; j++)
                {
                    Console.WriteLine("锯齿数组第{0}行{1}列的元素：{2}", i, j, arr_int[i][j]);
                }
            }
            Console.WriteLine("---------简写：数组------------");
            int[] arry_int = new int[] { 1, 2, 3, 4, 5, 6 };//一维数组：链表：6个元素
            int[,] arr_int12 = new int[1, 5]
            {
               { 1, 2, 3, 4, 5}
            };
            int[,] arr_int2 = new int[3,5]//二维数组：3个中括号里面有5个元素的值
            {
               {1,2,3,6,9},
               {2,3,4,5,7},
               {2,3,4,5,7}
            };
            int[, ,] arr_int13 = new int[5, 6, 3]//5个中括号里面每个里面有6个中括号里面有3个元素的值
            {
                {{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3}},
                {{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3}},
                {{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3}},
                {{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3}},
                {{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3}}
            };
            int[][] arr_int3 = new int[][]//交错数组：数组的数组（数组2.0）
            {
                new int[]{1,2,3,4,5,6},
                new int[]{1,2,5}
            };

            int[][,] arr_int4 = new int[][,]//一维交错数组：多维数组为单位组成的简单数组
            {
               new int[,]{{1,2,3,4,5},{1,2,3,6,7},{2,5,6,7,8}},
               new int[,]{{2,1},{2,1},{2,1}},
               new int[,]{{2,1},{2,1}}
            };
            int[,][] arr_int5 = new int[,][]//多维+交错数组：简单数组为单位组成的多维数组
            {
               {new int[]{1,2,3,4,5,6},new int[]{1,2,5}},
               {new int[]{1,2,3},new int[]{1,2,5}},
               {new int[]{4,5,6},new int[]{1,5}}
            };
            int[,][,] arr_int6 = new int[,][,]//多维+交错数组：多维数组为单位组成的多维数组
            {
                { new int[,]{{1,2,3,4,5},{1,2,3,6,7},{2,5,6,7,8}}, new int[,]{{2,1},{2,1},{2,1}}},
                { new int[,]{{1,2,3,4,5},{1,2,3,6,7},{2,5,6,7,8}}, new int[,]{{2,1},{2,1},{2,1}}}
            };
            Console.ReadKey();
        }

    }

}
